# !/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName  :create_app.py
# @Time      :2022/8/11 9:27
# @Author    :吕华龙
from flask import Flask
from models.model import db
from flask_migrate import Migrate
from views.user import user_bp
from utils.cache import cache


def create_app(config):
    app = Flask(__name__)
    app.config.from_object(config)
    db.init_app(app)
    Migrate(app, db)
    cache.init_app(app)
    app.register_blueprint(user_bp)

    return app
